using CxRomos.Core.Services;
using CxRomos.Web.Account.Interface;
using StructureMap;

namespace CxRomos.Web.Account.Presenter {
    public class LoginPresenter {
        private ILogin _view;
        private IAccountService _accountService;
        private IRedirector _redirector;

        public void Init(ILogin view) {
            _view = view;
            _accountService = ObjectFactory.GetInstance<IAccountService>();
            _redirector = ObjectFactory.GetInstance<IRedirector>();
        }

        public void Login(string username, string password) {
            var message = _accountService.Login(username, password);
            _view.DisplayMessage(message);
        }

        public void GoToRecoveryPassword() {
            _redirector.GoToAccountRecoveryPasswordPage();
        }

        public void GoToRegister() {
            _redirector.GoToAccountRegisterPage();
        }
    }
}